<?php

/**
 * 订单模型
 */
class OrderModel extends AutoMapModel {

    protected $tableName = 'orderform';
    
    public $_map = array(
        'id'             => 'orderform0', //订单ID
        'innId'          => 'orderform1', //客栈ID
        'menuId'         => 'orderform2', //分类标志618
        'orderNum'       => 'orderform3', //订单号
        'innName'        => 'orderform4', //客栈名称
        'contact'        => 'orderform5', //联系人姓名
        'orderTime'      => 'orderform6', //下单时间
        'uid'            => 'orderform7', //会员id
        'personCount'    => 'orderform8', //入住人数
        'checkinDate'    => 'orderform9', //入住日
        'textContent'    => 'orderform10', //订单内容
        'status'       => 'orderform11', //处理状态
        'isValid'        => 'orderform12', //订单有效性
        'reply'          => 'orderform13', //综合处理意见及理由
        'staffPhone'     => 'orderform14', //工作人员电话
        'staffEmail'     => 'orderform15', //工作人员邮箱
        'totalAmount'    => 'orderform16', //总金额
        'depositAmount'  => 'orderform17', //定金金额
        'depositDate'    => 'orderform18', //定金支付期限
        'balanceAmount'  => 'orderform19', //余款金额
        'balanceDate'    => 'orderform20', //余款支付期限
      //''      => 'orderform21', //
        'staffName'      => 'orderform22', //工作人员
        'replyTime'      => 'orderform23', //工作人员处理时间
        'otherReply'     => 'orderform24', //其它处理意见
        'otherMark'      => 'orderform25', //其它标识
        'email'          => 'orderform26', //电子邮件
        'isDel'          => 'orderform27', //删除标识
        'dealTime'       => 'orderform28', //订单处理时间
      //''               => 'orderform29', //
        'checkoutDate'   => 'orderform30', //离店时间
        'roomId'         => 'orderform31', //房型id
      //''               => 'orderform32', //
        'exchange'       => 'orderform33', //积分兑换金额
        'roomcount'      => 'orderform34', //房间数量
        'orderType'      => 'orderform35', //预定类型
    );
    
    public function _initialize() {
        parent::_initialize();
        $this->viewFields = array(
            $this->tableName => array_merge(
                $this->_map_flip,
                array('_type'=>'LEFT')
            ),
            'pay'=>array(
                '_type'=>'LEFT',
                '_on' => 'pay.pay1=' . $this->tableName . '.'.$this->_map['orderNum'],
                //'pay0'  => 'id'            , //ID
                //'pay1'  => 'orderNum'      , //订单号
                //'pay2'  => 'menuId'        , //分类标志573
                'pay3'  => 'depositPay'    , //定金支付金额
                'pay4'  => 'depositTime'   , //定金支付时间
                'pay5'  => 'depositType'   , //定金支付方式
                'pay6'  => 'depositConfirm', //定金支付确认
                'pay7'  => 'balancePay'    , //余款支付金额
                'pay8'  => 'balanceTime'   , //余款支付时间
                'pay9'  => 'balanceType'   , //余款支付方式
                'pay10' => 'balanceConfirm', //余款支付确认
                'pay11' => 'depositRemark' , //定金备注
                'pay12' => 'balanceRemark' , //余款备注
                'pay13' => 'depositWorker' , //定金确认人员
                'pay14' => 'balanceWorker' , //余款确认人员
            ),
            'hotelroom' => array(
                '_on' => 'hotelroom.hotelroom0=' . $this->tableName . '.'.$this->_map['roomId'],
                'hotelroom1' => 'room_name'
            ),
        );
    }
}

?>